﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class parent
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _parent_id = -99;
        private string _father_name = "";
        private string _mother_name = "";
        private string _father_qualification= "";
        private string _mother_qualification = "";
        private string _father_occupation = "";
        private string _mother_occupation = "";
        private string _permanent_address = "";
        private long _phone_no = -99;
        private string _parent_emailid = "";
        private long _user_type_id = -99;
        private string _username = "";
        private string _password = "";
        private long _student_id = -99;
        private string _security_question = "";
        private string _answer = "";
        private bool _isdeleted = false;
        public long parent_id
        {
            get
            {
                return _parent_id;
            }
            set
            {
                _parent_id = value;
            }
        }
        public string father_name
        {
            get
            {
                return _father_name;
            }
            set
            {
                _father_name = value;
            }
        }
        public string mother_name
        {
            get
            {
                return _mother_name;
            }
            set
            {
                _mother_name = value;
            }
        }
        public string father_qualification
        {
            get
            {
                return _father_qualification;
            }
            set
            {
                _father_qualification = value;
            }
        }
        public string mother_qualification
        {
            get
            {
                return _mother_qualification;
            }
            set
            {
                _mother_qualification = value;
            }
        }
        public string father_occupation
        {
            get
            {
                return _father_occupation;
            }
            set
            {
                _father_occupation = value;
            }
        }
        public string mother_occupation
        {
            get
            {
                return _mother_occupation;
            }
            set
            {
                _mother_occupation = value;
            }
        }
        public string permanent_address
        {
            get
            {
                return _permanent_address;
            }
            set
            {
                _permanent_address = value;
            }
        }
        public long phone_no
        {
            get
            {
                return _phone_no;
            }
            set
            {
                _phone_no = value;
            }
        }
        public string parent_emailid
        {
            get
            {
                return _parent_emailid;
            }
            set
            {
                _parent_emailid = value;
            }
        }
        public long user_type_id
        {
            get
            {
                return _user_type_id;
            }
            set
            {
                _user_type_id = value;
            }
        }
        public long student_id
        {
            get
            {
                return _student_id;
            }
            set
            {
                _student_id = value;
            }
        }
        public string username
        {
            get
            {
                return _username;
            }
            set
            {
                _username = value;
            }
        }
        public string password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
            }
        }
        public string security_question
        {
            get
            {
                return _security_question;
            }
            set
            {
                _security_question = value;
            }
        }
        public string answer
        {
            get
            {
                return _answer;
            }
            set
            {
                _answer = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@parent_id", parent_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@father_name", father_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@mother_name", mother_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@father_qualification", father_qualification, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@mother_qualification", mother_qualification, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@father_occupation", father_occupation, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@mother_occupation", mother_occupation, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@phone_no", phone_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9= DAC.Parameter("@parent_emailid", parent_emailid, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam16= DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9,dbparam10, dbparam11, dbparam12,dbparam13,dbparam14,dbparam15,dbparam16 };
                return DAC.Save("parent_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long parent_id,string father_name,string mother_name,string father_qualification,string mother_qualification ,string father_occupation ,string mother_occupation ,string permanent_address,long phone_no ,string parent_emailid ,long user_type_id,string username,string password,long student_id,string security_question,string answer, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@parent_id", parent_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@father_name", father_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@mother_name", mother_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@father_qualification", father_qualification, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@mother_qualification", mother_qualification, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@father_occupation", father_occupation, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@mother_occupation", mother_occupation, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@phone_no", phone_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@parent_emailid", parent_emailid, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam17 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9,dbparam10, dbparam11, dbparam12, dbparam13,dbparam14,dbparam15,dbparam16,dbparam17 };
                DataTable dt1 = DAC.Select("parent_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
